﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TowerArcher : Tower {
    public Transform spawnPoint;

    public override void Awake()
    {
        base.Awake();
        towerType=TowerType.Archer;
    }
    protected override void Attack()
    {
        Monster monster= target.GetComponent<Monster>();
        if(monster==null) return;
        ObjectFactory.CreatBullet("Arrow",(bullet)=>{
            bullet.GetComponent<Bullet>().SetTarget(monster,this);
            bullet.transform.position=spawnPoint.transform.position;
            bullet.transform.rotation=spawnPoint.transform.rotation;
        });
    }
    public override GameObject Up()
    {
        GameObject obj = null;
        switch (level)
        {
            case 1:
                obj = Resources.Load<GameObject>("Tower/Archer/war_tower_top_1_2");
                break;
            case 2:
                obj = Resources.Load<GameObject>("Tower/Archer/war_tower_top_1_3");
                break;
            case 3:
                obj = Resources.Load<GameObject>("Tower/Archer/war_tower_top_1_4");
                break;
            case 4:
                break;
        }
        return obj;
    }
    public override void Sell()
    {
        base.Sell();
    }


}
